home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / util / Leaks-dcmd.sit / Leaks dcmd / dcmd.p < prev    next >
Text File  |  1991-10-09  |  6KB  |  149 lines

  1. {    dcmd.p
  2.   This is the dcmd interface.
  3.      Copyright © 1988 Apple Computer, Inc.  All rights reserved.
  4. }
  5.  
  6. UNIT dcmd;
  7.  
  8. INTERFACE
  9.  
  10.         CONST { Possible requests from the debugger to the command }
  11.                                 dcmdInit = 0;
  12.                                 dcmdDoIt = 1;
  13.                                 dcmdHelp = 2;
  14.         
  15.                                 D0Register   = 0;
  16.                                 D1Register   = 1;
  17.                                 D2Register   = 2;
  18.                                 D3Register   = 3;
  19.                                 D4Register   = 4;
  20.                                 D5Register   = 5;
  21.                                 D6Register   = 6;
  22.                                 D7Register   = 7;
  23.  
  24.                                 A0Register   = 8;
  25.                                 A1Register   = 9;
  26.                                 A2Register   = 10;
  27.                                 A3Register   = 11;
  28.                                 A4Register   = 12;
  29.                                 A5Register   = 13;
  30.                                 A6Register   = 14;
  31.                                 A7Register   = 15;
  32.  
  33.                                 PCRegister   = 16;
  34.                                 SRRegister   = 17;        { SR is only 16 bits and is stored in the high word }
  35.         
  36.               freeBlock           = 0;
  37.                                 nonrelocatableBlock = 1;
  38.                                 relocatableBlock    = 2;
  39.  
  40.         TYPE RegFilePtr   = ^RegFile;
  41.                             RegFile      = ARRAY [0..17] OF LONGINT;
  42.         
  43.                             dcmdBlockPtr = ^dcmdBlock;
  44.                             dcmdBlock    = RECORD
  45.                                 registerFile: RegFilePtr;
  46.                                 request:      INTEGER;
  47.                                 aborted:      BOOLEAN;     { Set to true if the user types a key while scrolling }
  48.                                 END;
  49.  
  50. {EJECT}
  51.  
  52.   { Pacsal declarations for debugger call back routines that can be used by a dcmd }
  53.  
  54.   { Draw the text in the Pascal string as one or more lines separated by CR's.
  55.           Each line causes the MacsBug display to be scrolled and the new line to be
  56.                 drawn at the bottom. If the user types a key while scrolling then the aborted
  57.                 flag is set telling the command to terminate immediately. }
  58.         PROCEDURE dcmdDrawLine (str: Str255);
  59.  
  60.   { Draw the text in the Pascal string as a continuation of the current line.
  61.           CR's are not given special treatment. }
  62.         PROCEDURE dcmdDrawString (str: Str255);
  63.  
  64.   { Draw a given number of characters starting from the given pointer as a 
  65.        continuation of the current line. CR's are not given special treatment. }
  66.   PROCEDURE dcmdDrawText(text: StringPtr; length: INTEGER);
  67.  
  68.   { Scrolls the MacsBug display up one line leaving a blank line at the bottom. }
  69.   PROCEDURE dcmdScroll;
  70.  
  71.   { Display the Pascal string in the command line area and wait for a key to be pressed.
  72.           Return TRUE if the user typed Return. All other keys return FALSE. MacsBug saves this
  73.                 key and adds it to the command line once the current command completes. Typing any
  74.                 key other than Return sets the aborted flag and tells the command to terminate immediately. }
  75.         FUNCTION dcmdDrawPrompt (str: Str255) : BOOLEAN;
  76.  
  77.   { Get the current command line position }
  78.         FUNCTION dcmdGetPosition : INTEGER;
  79.         
  80.         { Set the current command line position. This should only be set to a value returned 
  81.           by dcmdGetPosition. }
  82.         PROCEDURE dcmdSetPosition (pos: INTEGER);
  83.  
  84.   { Return the next character on the command line or CR if the entire line has been scanned }
  85.         FUNCTION dcmdGetNextChar : CHAR;
  86.         
  87.   { Return the next character on the command line or CR if the entire line has been scanned.
  88.           However, the current command line position is not changed. }
  89.         FUNCTION dcmdPeekAtNextChar : CHAR;
  90.         
  91.   { Copy all characters from the command line to the parameter string until a delimiter
  92.           is found or the end of the command line is reached. A delimiter is either a space,
  93.                 a comma or a CR. Both single and double quoted strings are allowed on the command
  94.                 line. However, the leading and trailing quotes must be of the same type. The parameter
  95.                 string is returned without the quotes. This function returns the delimiter }
  96.         FUNCTION dcmdGetNextParameter (VAR str: Str255) : CHAR;
  97.  
  98.   { Parse the command line for the next expression. All expressions are evaluated to 32 bits.
  99.           This function returns the delimiter after the expression. The possible delimiters are
  100.                 space, comma and CR.  Space is    not treated as a delimiter in the middle of expressions.
  101.                 For instance, '1 + 2' will return    a value of 3 and the delimiter will be the char following
  102.                 the 2. The return parameter 'ok' tells if the expression was parsed successfully. }
  103.         FUNCTION dcmdGetNextExpression (VAR value: LONGINT; VAR ok: BOOLEAN) : CHAR;        
  104.  
  105.         { Copy the break message MacsBug displayed the last time it was entered into str.
  106.                 This may contain multiple lines separated by CR's. }
  107.         PROCEDURE dcmdGetBreakMessage  (VAR str: Str255);
  108.         
  109.         { Return a symbolic representation for address in str. If no symbol can be found
  110.                 then an empty string is returned. The format of the symbol returned is Name+0000.
  111.                         With the new compilers, the name is no longer restricted to 8 characters. }
  112.         PROCEDURE dcmdGetNameAndOffset (address: LONGINT; VAR str: Str255);
  113.  
  114.   { Return the trap name for the trap number. If no symbol can be found
  115.                 then an empty string is returned. }
  116.         PROCEDURE dcmdGetTrapName (trapNumber: INTEGER; VAR trapName: Str255);
  117.  
  118.   { Return a pointer the macro name for the given value. If no macro can be found
  119.                 then a nil is returned. }
  120.   FUNCTION dcmdGetMacroName(value: LONGINT): StringPtr;
  121.  
  122.   { When a debugger command is called, the debugger's world (low memory) is installed.
  123.           Commands that want to reference the user's world can swap back and forth between the
  124.                 two worlds by making this call. This procedure does nothing in MacsBug. It is included
  125.                 to support other debuggers that might want to take advantage of it. }
  126.   PROCEDURE dcmdSwapWorlds;
  127.  
  128.   { Toggle between the user and debugger displays.
  129.           The first call restores the user's actual screen.
  130.           The second call restores the debugger's screen. }
  131.         PROCEDURE dcmdSwapScreens;
  132.  
  133.   { Walk thru the blocks in the current heap, calling DoThis for each block. DoThis should
  134.           be a procedure of the form:
  135.                 
  136.             PROCEDURE DoThis (blockAddress, blockLength, addrOfMasterPtr: LONGINT;
  137.                                           blockType: INTEGER;
  138.                               locked, purgeable, resource: BOOLEAN);
  139.  
  140.           The blockAddress and blockLength pertain to the data in the heap block, not including
  141.                 the block header. The addrOfMasterPtr is the master pointer's location in the heap,
  142.                 not the value of the master ptr. The blockType is defined by the constants freeBlock,
  143.                 nonrelocatableBlock and relocatableBlock. The booleans locked, purgeable and resource
  144.                 reflect the state of the block.    }
  145.   PROCEDURE dcmdForAllHeapBlocks (DoThis: ProcPtr);
  146.  
  147. IMPLEMENTATION
  148.  
  149. END.